#include <JXQCore/JMeta>
#include <JXQCore/JDebug>

class A
{
public:
	A()
	{
		jDebug() << "create A";
	}
	~A()
	{
		jDebug() << "delete A";
	}

    J_INVOKE A *func()
	{
		jDebug() << "hello world" << this << &A::func1;
		return this;
	}

    J_INVOKE A func1(const JXQ::JString &str, int a)
	{
		jDebug() << " ---- hello world 1111 5 -" << this << "a =" << a;
        return A();
	}

    J_INVOKE static long func2()
	{
		jDebug() << "static A::func2";
		return 11;
	}
};
J_NAME_DECLARE_TYPE(A, "A", A)
J_DECLARE_INVOKE_NAME("func", A_func, &A::func)
J_DECLARE_INVOKE_NAME("func1", A_func1, &A::func1)
J_DECLARE_INVOKE_NAME("A::func2", A_func2, &A::func2)

class B
{
public:
    J_INVOKE A func()
	{
		return A();
	}
};
J_DECLARE_INVOKE_NAME("func", B_func, &B::func)

static J_INVOKE int func1(JXQ::JString str)
{
	jDebug() << " ---- hello world 222 1 -" << str;
	return str.toInt();
}
J_DECLARE_INVOKE(func1, func1)
J_DECLARE_INVOKE_NAME("func1_1", func1_1, func1)

static J_INVOKE int func3(const JXQ::JString &str)
{
	jDebug() << " ---- hello world 666 3 -" << str;
	return str.toInt();
}
J_DECLARE_INVOKE(func3, func3)
